﻿<!DOCTYPE HTML>
<html>
<head>
    <title>查询</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/dpl.css" rel="stylesheet">
    <link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/bui.css" rel="stylesheet">
    @*<link href="../assets/css/dpl-min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/css/bui-min.css" rel="stylesheet" type="text/css" />*@
    <link href="../assets/css/page-min.css" rel="stylesheet" type="text/css" />   <!-- 下面的样式，仅是为了显示代码，而不应该在项目中使用-->
    <link href="../assets/css/prettify.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        code {
            padding: 0px 4px;
            color: #d14;
            background-color: #f7f7f9;
            border: 1px solid #e1e1e8;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="row">
            <form id="searchForm" class="form-horizontal span24">
                <div class="row">
                    <div class="control-group span8">
                        <label class="control-label">商品信息：</label>
                        <div class="controls">
                            <input type="text" class="control-text" name="productInfo" placeholder="输入商品相关描述">
                        </div>
                    </div>
                    <div class="control-group span8">
                        <label class="control-label">快递信息：</label>
                        <div class="controls">
                            <input type="text" class="control-text" name="logisticsInfo" placeholder="输入快递单号">
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="control-group span12">
                        <label class="control-label">购买时间：</label>
                        <div class="controls">
                            <input type="text" class="calendar" name="startDate"><span> - </span><input name="endDate" type="text" class="calendar">
                        </div>
                    </div>
                    <div class="control-group span12">
                        <label class="control-label">是否完成付款：</label>
                        <div class="controls">
                            <select name="isdeducted">
                                <option value="0">--所有--</option>
                                <option value="True">--已完成--</option>
                                <option value="False">--未完成--</option>
                            </select>
                        </div>
                    </div>
                   
                </div>
                <div class="row" style="margin-bottom:5px;">
                    <div class="span3 offset2">
                        <button type="submit" id="btnSearch" class="button button-primary">搜索</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="search-grid-container">
            <div id="grid"></div>
        </div>
    </div>
    <script type="text/javascript" src="~/assets/js/jquery-1.8.1.min.js"></script>
    <script type="text/javascript" src="~/assets/js/bui-min.js"></script>
    <script type="text/javascript" src="~/assets/js/config-min.js"></script>
    <script type="text/javascript">
        BUI.use('common/page');
    </script>
    <script src="http://g.tbcdn.cn/fi/bui/bui-min.js?t=201309041336"></script>
    <script type="text/javascript">
        var Grid = BUI.Grid,
            Store = BUI.Data.Store,
            columns = [
                { title: '订单编号', width: 100, sortable: false, dataIndex: 'no' },
                { title: '商品描述', width: 100, sortable: true, dataIndex: 'productInfo', selectable: true },
                {
                    title: '快递信息', width: 150, sortable: false, dataIndex: 'logisticsInfo'
                },
                { title: '价格', width: 100, sortable: true, dataIndex: 'salePrice'},
                { title: '时间', width: 100, sortable: true, dataIndex: 'date' },
                { title: '备注', width: 100, sortable: true, dataIndex: 'remark' },
                {
                    title: '是否完成付款', width: 100, sortable: true, dataIndex: 'isDeducted', renderer: function (value, obj) {
                        if (value) {
                            return "完成"
                        } else {
                            return "<span style='color:red'><b>未完成,还需支付：" + obj.remainPaymentMoney + "</b></span>";
                        }
                    }
                },
                { title: '状态', width: 100, sortable: true, dataIndex: 'status' }
            ];

        var store = new Store({
            url: '/order/list',
            autoLoad: true,
            pageSize: 10
        }),
            grid = new Grid.Grid({
                render: '#grid',
                loadMask: true,
                forceFit: true,
                columns: columns,
                store: store,
                plugins: [ Grid.Plugins.AutoFit], //勾选插件、自适应宽度插件
                
                // 顶部工具栏
                bbar: {
                    //items 也可以在此配置
                    // pagingBar:表明包含分页栏
                    pagingBar: true
                }
            });

        grid.render();

        //创建表单，表单中的日历，不需要单独初始化
        var form = new BUI.Form.HForm({
            srcNode: '#searchForm'
        }).render();

        form.on('beforesubmit', function (ev) {
            //序列化成对象
            var obj = form.serializeToObject();
            obj.start = 0; //返回第一页
            store.load(obj);
            return false;
        });
    </script>

</body>
</html>
